package com.bdmc.report.domain.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.bdmc.common.convert.LocalDateConverter;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

import static com.bdmc.common.utils.DateUtils.getTime;

;

/**
 * 怠速时长以及油耗视图对象 report_car_stop
 *
 * @author bdmc
 * @date 2022-08-09
 */
@Data
@ExcelIgnoreUnannotated
public class ReportCarStopVo {

	private static final long serialVersionUID = 1L;

	/**
	 * 部门名称
	 */
	@ExcelProperty(value = "所属部门")
	private String deptName;

    /**
     * 主键
     */
	private Long stopId;

    /**
     * 人员id
     */
	private Long personId;

    /**
     * 人员名称
     */
	@ExcelProperty(value = "人员名称")
	private String personName;

    /**
     * 车辆id
     */
	private Long carId;

    /**
     * 车牌号
     */
	@ExcelProperty(value = "车牌号")
	private String carNum;

    /**
     * 围栏id
     */
	private Long fenceId;

    /**
     * 围栏名称
     */
	@ExcelProperty(value = "围栏名称")
	private String fenceName;

    /**
     * 数据日期
     */
	@ExcelProperty(value = "数据日期",converter = LocalDateConverter.class)
	@JsonFormat(pattern = "yyyy-MM-dd")
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private LocalDate dataTime;

    /**
     * 开始时间
     */
	//@ExcelProperty(value = "开始时间",converter = LocalDateTimeConverter.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime startTime;

    /**
     * 结束时间
     */
	//@ExcelProperty(value = "结束时间",converter = LocalDateTimeConverter.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private LocalDateTime endTime;

    /**
     * 怠速时长
     */
	private Long stopTime;
	
	@ExcelProperty(value = "怠速时长")
	private String stopTimeStr;
	public String getStopTimeStr(){
		return getTime(stopTime);
	}

	@ExcelProperty(value = "停留时段")
	private String workTime;
    /**
     * 起始油量
     */
	private BigDecimal startOil;

    /**
     * 结束油量
     */
	private BigDecimal endOil;

    /**
     * 油量消耗
     */
	private BigDecimal oilCost;
	@ExcelProperty(value = "纬度")
	private String lat;

	/**
	 * 经度
	 */
	@ExcelProperty(value = "经度")
	private String lng;

	/**
	 * 停留地址
	 */
	@ExcelProperty(value = "停留地址")
	private String address;

}
